Skip to content

Add multi-spec serving: repeatable --spec with deterministic name prefixes - #42

Merged
haasonsaas merged 1 commit into
mainfrom
feat/multi-spec
Aug 4, 2026
Merged

Add multi-spec serving: repeatable --spec with deterministic name prefixes#42
haasonsaas merged 1 commit into
mainfrom
feat/multi-spec

Conversation

@haasonsaas

Copy link
Copy Markdown
Collaborator

One server can now front several OpenAPI documents:

mcp-openapi --spec github=./github.yaml --spec linear=./linear.yaml
# tools: github_listIssues, linear_createIssue, ...

Rules, all covered by tests:

  • Single --spec: identical behavior to before — bare operationIds, same cache path.
  • Multiple specs: every tool gets the spec's prefix (explicit name= or file basename, normalized). Prefixing is unconditional rather than collision-triggered so tool names never depend on what other specs are loaded — --allow-tools/--deny-tools patterns stay stable.
  • Collisions after prefixing get a numeric suffix (sample-openapi_getHealth_2).
  • Per-spec compile cache files (<cache-path>.<name>); --watch-spec watches all files and recompiles the merged set.
  • --server-url with multiple specs is a hard error (upstream URLs come from each spec's servers[]); generate requires exactly one spec.

Tests: 5 new (47 total) — prefix determinism, basename fallback + suffixing, single-spec unchanged, --server-url rejection, and a stdio e2e that lists and calls beta_getHealth across two loaded specs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LqBsGC7xLvihtBxhCdWKz5

…fixes

--spec now accepts [name=]path and can be given multiple times. With one
spec, behavior is unchanged (bare operationIds). With several, each tool
is prefixed with the spec's explicit name or file basename, so names are
deterministic and allow/deny patterns keep working; residual collisions
get a numeric suffix. Compile caches are per spec (cachePath.name),
--watch-spec watches every file, --server-url and generate require a
single spec.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqBsGC7xLvihtBxhCdWKz5
@haasonsaas
haasonsaas merged commit 162e59c into main Aug 4, 2026
4 checks passed
@haasonsaas
haasonsaas deleted the feat/multi-spec branch August 4, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant